package myservice.android.utilities;

import myservice.android.activities.BaseSaveableActivity;
import android.text.Editable;
import android.text.TextWatcher;

/**
 * Listener for all EditText views that sets the activity as unsaved when the text is modified.
 */
public class EditTextMonitor implements TextWatcher {
	
	private BaseSaveableActivity activity;
	
	public EditTextMonitor(BaseSaveableActivity activity) {
		this.activity = activity;
	}

	@Override
	public void afterTextChanged(Editable s) { }

	@Override
	public void beforeTextChanged(CharSequence s, int start, int count,	int after) { }	

	@Override
	public void onTextChanged(CharSequence s, int start, int before, int count) {
		activity.activityContentModified = true;		
	}	

}
